C# examples of using the SDK
Blueprint examples
Action Object examples
-
Creating a Real-time Action Object - Loading from a blueprint MGD file
-
Deploying a Real-time Action Object – With runnability check
-
Deploying a Scheduled Action Object – Blueprints with historical data sources
-
Managing Real-time Action Objects – Deploying and removing an Action Object
-
Managing Real-time Action Objects – Stopping all Action Objects
Executor examples
CAF examples
Blueprint Examples
Configuring a blueprint – Adding a new sink block
C#: |
String fileName = "C:\\MyBlueprint.mgd"; |
Configuring a blueprint – Configuring a newly added block
C#: |
String fileName = "C:\\MyBlueprint.mgd"; |
Configuring a blueprint – Connecting a block
C#: |
String fileName = "C:\\MyBlueprint.mgd"; |
Action Object Examples
Creating a Real-time Action Object - Loading from XML
C#: |
String fileName = "C:\\MySourceBlueprint.xml"; |
Creating a Real-time Action Object - Loading from a blueprint MGD file
C#: |
String fileName = "C:\\MySourceBlueprint.mgd"; |
Check runnability
C#: |
String fileName = "C:\\MySourceBlueprint.xml"; |
Check runnability and write results to file
C#: |
String fileName = "C:\\MySourceBlueprint.xml"; |
Exporting a blueprint to XML
C#: |
String fileName = "C:\\MySourceBlueprint.mgd"; |
Deploying a Real-time Action Object – No runnability check
C#: |
String fileName = "C:\\MySourceBlueprint.mgd"; |
Deploying a Real-time Action Object – With runnability check
C#: |
String fileName = "C:\\MySourceBlueprint.mgd"; |
Deploying a Scheduled Action Object – Blueprints with historical data sources
C#: |
String fileName = "C:\\MySourceBlueprint.mgd"; |
Deploying Event-based Action Objects
C#: |
String fileName = "C:\\MyBlueprint.mgd"; |
Execute a deployed Event-based Action Object
C#: |
// Get a list of available Event-based Action Objects // Execute the first Event-based Action Object |
Managing Real-time Action Objects – Deploying and removing an Action Object
C#: |
String fileName = "C:\\MyBlueprint.mgd"; |
Managing Real-time Action Objects – Stopping all Action Objects
C#: |
ActionObjectServer server = new ActionObjectServer(); |
Executor Examples
Using the ISVExecutor class in the SDK
C#: |
// Load in your custom blueprint // Create ISV Executor // Alternative way to construct the ISVExecutor: // Get the current time in a UTC format // Setup input fields for each input of your ISV; in this case 3 inputs // Execute the ISV object with the configured inputs // Read the values back // Execute the ISV object again at a newer timestamp // Write a custom program loop to call isvExecutor.Execute(DateTime executeTime) as many times as you want to produce new outputs // If needed, save the internal ISV object to a new .isv file |
Using the Source Block Executor class in the SDK
C#: |
// Create a source block and initialize the HistoricalSourceBlockExecutor class // Setup events on a configured Historical Source Executor // Execute the Historical Block used in this example, the block is executed as long as it has data. // Show output values of the historical source after execution |
Using the Real-time Source Block Executor class in the SDK
C#: |
// Create a source block and initialize the RealtimeSourceBlockExecutor class // Setup events on a configured Realtime Source Executor // Run and stop the Realtime Source Executor // Add code to wait for a specified amount of time or wait until the source finishes execution by itself (this will not happen with all sources!) |
Using the Sink Block Executor class in the SDK
C#: |
// Create a sink block and initialize the SinkBlockExecutor class // Setup events on a configured Sink Executor // Execute the sink block used |
CAF Examples
Calling the Analytic Executor/Creating analytic block
C#: |
Proficy.CSense.SDK.Runtime.AnalyticRepository analyticRepository = new Proficy.CSense.SDK.Runtime.AnalyticRepository(); // Calling the analytic executor // Creating analytic block |
Configuring analytic inputs of the Analytic Block
C#: |
// Iterate through Analytic inputs and determine what class types they are // Set the value of a Single Analytic input // Set values of a Variable Analytic input |
Configuring analytic outputs of the Analytic Block
C#: |
// Iterate through Analytic outputs and determine what class types they are // Set the value of a Single Analytic output // Set values of a Variable Analytic output |
Configuring analytic properties of the Analytic Block
C#: |
// Iterate through Analytic properties and determine what class types they are // Set the value of a Single Analytic property // Set the values of Variable Analytic properties // Set value(s) on composite properties on a property |
Configuring and executing the Analytic with Analytic Executor
C#: |
// Get Analytic from the repository // Pass the analytic into the executor // Set the input values |